<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="btn">按钮</button>

    <script>
        //fetch核心
        //1.创建请求
        //2.发送请求JSON
        //3.处理响应
        //4.错误处理
        document.querySelector('.btn').addEventListener('click', async () => {
            const res = await fetch('https://www.bilibili.com/')
            const data = await res.json()
            console.log(data)
        })
    </script>
</body>

</html>